<div class="container" id="app">






<div class="row">
    <div class="col-md-12">    
        <ol class="breadcrumb">
            <li>
                <a href="<?=base_url('main')?>">首页</a>
            </li>
            <li class="active"><?=$catagory['catagory_title']?></li>
        </ol>
    </div>
</div>






<div class="row">






    <div class="col-sm-6">


    <div class="panel panel-default">
    <div class="panel-heading">任务清单</div>
    <div class="panel-body">
    <p>正在进行</p>
        <ul>
            <?php foreach($catagory_sidebar['1'] as $catagory_key => $catagory_value){ ?>
                <li>
                    <a href="<?=base_url('main/catagory/') . $catagory_value["catagory_id"]?>"><?=$catagory_value["catagory_date"]?>-<?=$catagory_value["catagory_title"]?></a>
                    <a href="<?=base_url('main/catagory_edit/') . $catagory_value["catagory_id"]?>">#</a>
                    <?php if($catagory_value["catagory_task"] != ''){echo '<pre>' . $catagory_value["catagory_task"] . '</pre>' ;}?>
                </li>
            <?php } ?>
        </ul>

        <p>正在等待</p>
        <ul>
            <?php foreach($catagory_sidebar['2'] as $catagory_key => $catagory_value){ ?>
                <li><a href="<?=base_url('main/catagory/') . $catagory_value["catagory_id"]?>"><?=$catagory_value["catagory_date"]?>-<?=$catagory_value["catagory_title"]?></a>
                <br><?php if($catagory_value["catagory_task"] != ''){echo '<pre>' . $catagory_value["catagory_task"] . '</pre>' ;}?>
                </li>
            <?php } ?>
        </ul>


        <p>长期任务</p>
        <ul>
            <?php foreach($catagory_sidebar['3'] as $catagory_key => $catagory_value){ ?>
                <li><a href="<?=base_url('main/catagory/') . $catagory_value["catagory_id"]?>"><?=$catagory_value["catagory_date"]?>-<?=$catagory_value["catagory_title"]?></a>
                <br><?php if($catagory_value["catagory_task"] != ''){echo '<pre>' . $catagory_value["catagory_task"] . '</pre>' ;}?>
            </li>
            <?php } ?>
        </ul>


        <p>已经完成</p>
        <ul>
            <?php foreach($catagory_sidebar['0'] as $catagory_key => $catagory_value){ ?>
                <li><a href="<?=base_url('main/catagory/') . $catagory_value["catagory_id"]?>"><?=$catagory_value["catagory_date"]?>-<?=$catagory_value["catagory_title"]?></a>
                <br><?php if($catagory_value["catagory_task"] != ''){echo '<pre>' . $catagory_value["catagory_task"] . '</pre>' ;}?>
            </li>
            <?php } ?>
        </ul>
    </div>
</div>


    </div>





























    <div class="col-sm-6">


        <div class="panel panel-default">
            <div class="panel-heading">
                    <a href="<?=base_url('main/catagory_edit/') . $catagory['catagory_id']?>" class="btn btn-xs btn-default pull-right">编辑</a>
                    <h3 class="panel-title">Catagory Property</h3>
            </div>
            <div class="panel-body">
                    <pre><?=$catagory['catagory_note']?></pre>
            </div>
        </div>








<!-- ===================================
insect_post
=================================== -->




<div class="panel panel-default" >
    
    <div class="panel-heading">
        <span class="pull-right" @click="toggle_new_post">[显示/隐藏]</span>
        <h3 class="panel-title">为 「<?=$catagory['catagory_title']?>」项目添加新的消息：</h3>
    </div>

    <div class="panel-body" :style="style_new_post?'display:block':'display:none'">
        
        <form action="<?=base_url('main/insect_post')?>" method="POST" role="form">

            <div class="form-group">
                <label for="">Content:</label>
                <textarea name="post_content" class="form-control" cols="30" rows="10"></textarea>
            </div>

            <div class="form-group" style="display:none">
                <label for="">Catagory Title:</label>
                <input type="text" class="form-control" value="<?=$catagory['catagory_title']?>">
            </div>

            <div class="form-group" style="display:none">
                <label for="">Catagory ID:</label>
                <input type="text" class="form-control" name="post_catagory_id" value="<?=$catagory['catagory_id']?>">
            </div>

            <div class="form-group"style="display:none">
                <label for="post_ctime">Created time:</label>
                <input type="text" class="form-control" id="post_ctime" name="post_ctime" value="<?=Date('Y-m-d H:i:s')?>">
            </div>
        
            <button type="submit" class="btn btn-primary pull-right">Submit</button>
        </form>
        
    </div>
</div>








<!-- ===================================
POST
=================================== -->

<?php foreach($posts as $post_key => $post_value){ ?>


        <div class="panel panel-default">
            <div class="panel-heading">
                    <h3 class="panel-title">
                        <span class="pull-right"><a href="<?=base_url('main/post/') . $post_value['posts_catagory'] . '/' . $post_value['posts_id']?>" class="btn btn-xs btn-default">[编辑]</a></span>
                        liyi，<?=$post_value["posts_ctime"]?>，<?=$post_value["posts_update"]?>
                    </h3>
            </div>
            <div class="panel-body">
                    <p><pre><?=$post_value["posts_content"]?></pre></p>

                    <ul>
                        <?php foreach($post_value["posts_files_array"] as $file_key => $file_info){ ?>
                            <li>
                                <a target="_blank" href="<?=base_url('/uploads/') . $post_value['posts_catagory'] . '/' . $file_info["file_newname"]?>">
                                    <?=$file_info["file_oldname"]?>
                                    (<?=$file_info["file_size"]?>MB)
                                </a>
                            </li>

                        <?php }?>

                    </ul>

                    <div class="pull-right">
                        <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span> <?=$post_value["posts_catagory_title"]?>
                    </div>


                    <?php
                        if(is_array($post_value["posts_tags_array"])){
                            foreach($post_value["posts_tags_array"] as $tag_key => $tag_value){  
                    ?>
                        <a href="<?=base_url('main/tag/') . $tag_value['tag_id']?>" class="btn btn-xs btn-default">#<?=$tag_value['tag_title']?></a>
                    <?php
                            }//foreach
                        }else{
                            echo '';
                        } 
                    ?>

            </div>
        </div>


<?php } ?>

        

    </div>
</div>










</div><!-- .container -->
















<script>
    var app = new Vue({
        el:"#app",
        data:{
            msg:"Hello world",
            style_new_post:true,
        },
        methods:{
            toggle_new_post(){
                this.style_new_post = !this.style_new_post;
            },
        }
    })
</script>



